package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sc.nft.entity.RankingBoardDetailsEvenNumber;
import com.sc.nft.entity.RankingBoardRewardsConf;
import com.sc.nft.entity.dto.ListDetailsListDTO;
import com.sc.nft.entity.vo.ListDetailsListVO;
import com.sc.nft.mapper.RankingBoardDetailsNumberMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Slf4j
@Repository
public class RankingBoardDetailsNumberDao {

    @Resource
    private RankingBoardDetailsNumberMapper rankingBoardDetailsNumberMapper;

    public IPage<ListDetailsListVO> listDetailsList(ListDetailsListDTO listDetailsListDTO, String tableSegmentation) {
        return rankingBoardDetailsNumberMapper.listDetailsList(listDetailsListDTO.toMp(), listDetailsListDTO, tableSegmentation);
    }

    public ListDetailsListVO listDetailsListByUserId(Long id ,Long userId,String tableSegmentation) {
        return rankingBoardDetailsNumberMapper.listDetailsListByUserId(id, userId, tableSegmentation);
    }


    public void saveBath(List<RankingBoardDetailsEvenNumber> list, String table){
        rankingBoardDetailsNumberMapper.saveBath(list, table);
    }

    /**
     * 截断某一张表
     * @param table
     */
    public void deleteByRankingBoardConfId(String table){
        rankingBoardDetailsNumberMapper.deleteByRankingBoardConfId(table);
    }

    public void deleteOddnumberedTable(Long rankingBoardConfId) {
        rankingBoardDetailsNumberMapper.deleteOddnumberedTable(rankingBoardConfId);
    }

    public void deleteEvenTable(Long rankingBoardConfId) {
        rankingBoardDetailsNumberMapper.deleteEvenTable(rankingBoardConfId);
    }

}
